<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ActionLog extends Model
{
    use HasFactory;
    protected $fillable = [
        'uid',
        'content',
        'ip'
    ];
    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format('Y/m/d H:i:s');
    }
    public function buildSearch($where)
    {
        $query = parent::buildSearch($where);

        if (isset($where['uid'])) {
            $query = $query->where('uid', $where['uid']);
        }

        if (isset($where['ip'])) {
            $query = $query->where('ip', $where['ip']);
        }
        return $query;
    }
}
